#pragma once

#include <string>
#include <vector>
using namespace std;

class res_item
{
public:
	wstring name;
	struct{
		unsigned __int64 offset;
		unsigned __int64 size;
	};
};

class res_file
{
public:
	void clear();
	string prefix;
	unsigned int count;
	unsigned __int64 prefix_size;
	unsigned __int64 file_desc_size;
	vector<res_item> items;
};

class resource_manager
{
public:
	resource_manager(void);
	~resource_manager(void);

	bool extract_resource_files(const wstring& filename, const wstring& cachedir);
	bool restore_resource_files(const wstring& filename, const wstring& cachedir);

	bool pack(const wstring& cachedir, const char* data, unsigned int size);
	bool unpack(const wstring& cachedir, const char* data, unsigned int size);

	void extract_res_file(const wstring& cachedir, const wstring& filename, const char* data, unsigned int size);

private:
	res_file resfile;
};

